﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Newtonsoft.Json;

public partial class Rep_Cydzrb : System.Web.UI.Page
{
    BLL.BLLRep br = new BLL.BLLRep();
    BLL.BLLValRep bll = new BLL.BLLValRep();
    public static string pName = "";
    public static string pType = "";
    public static string jpg = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        string name = HttpUtility.UrlDecode(Request.QueryString["name"]);
        string type = HttpUtility.UrlDecode(Request.QueryString["type"]);
        if (name != null & name != "")
        {
            pName = name;
            jpg = name + "日报表";
        }

        if (type != null & type != "")
        {
            pType = type;
        }

        string param = Request["param"];
        if (param != "")
        {
            if (param == "query")
            {
                string time = Request["time"];
                string unit = Request["unit"];
                QueryTableList(pName, Convert.ToDateTime(time).ToString("yyyy-MM-dd"), unit, pType);
            }
        }
        else
        {
            QueryTableList(pName, DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), "1", pType);
        }
    }
    protected void QueryTableList(string pName, string time, string unit, string type)
    {
        string strApp = bll.RetTableByVal(pName, time, unit, type);
        object obj = new { tableInfo = strApp };
        string result = JavaScriptConvert.SerializeObject(obj);
        Response.Write(result);
        Response.End();
    }
}